package huy.mmt.gamelathinh.dialog;

import huy.mmt.gamelathinh.Main;
import huy.mmt.gamelathinh.R;
import huy.mmt.gamelathinh.util.Util;
import huy.mmt.gamelathinh.util.UtilDialog;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

/**
 * Hiá»‡n thá»‹ thÃ´ng bÃ¡o muá»‘n thoÃ¡t hay khÃ´ng. Yes thÃ¬ thoÃ¡t khá»�i game, No thÃ¬ tiáº¿p
 * tá»¥c
 * 
 * @author VAN GIOI
 * 
 */
public class DialogExit extends Dialog implements
		android.view.View.OnClickListener {

	Button yes, no;
	
	Activity activity;

	public DialogExit(Context context) {
		super(context);
		UtilDialog.iniDialog(this);
		activity = (Activity) context;
		setContentView(R.layout.dialog_exit);

		// resize dialog
		RelativeLayout linearLayout = (RelativeLayout) findViewById(R.id.linearlayout_all);
		Util.resizeDialog(linearLayout);

		no = (Button) findViewById(R.id.no_dialogexit);
		no.setOnClickListener(this);

		yes = (Button) findViewById(R.id.yes_dialogexit);
		yes.setOnClickListener(this);

	}

	@Override
	public void onClick(View v) {

		Main.click.start();

		switch (v.getId()) {
		case R.id.yes_dialogexit:
			this.dismiss();
			activity.finish();
			break;
		case R.id.no_dialogexit:
			this.dismiss();
			break;

		default:
			break;
		}

	}

}